import {
  validatePhone,
  validateEmail,
  validateIdCard,
  validateMoney,
  validateBankId
} from "@/utils/validates.js"

const addStuForm = {
  formRules: {
    username: {
      rules: [
        {
          required: true,
          errorMessage: "请输入学生姓名"
        }
      ],
      validateTrigger: "blur"
    },
    phone: {
      rules: [
        {
          required: true,
          errorMessage: "请输入手机号码"
        },
        {
          validateFunction: validatePhone
        }
      ]
    },
    parents_phone: {
      rules: [
        {
          required: false,
          errorMessage: "请输入手机号码"
        },
        {
          validateFunction: validatePhone
        }
      ]
    },
    mailbox: {
      rules: [
        {
          required: false,
          errorMessage: "请输入手机号码"
        },
        {
          validateFunction: validateEmail
        }
      ]
    },
    school_id: {
      rules: [
        {
          required: true,
          errorMessage: "请选择学校"
        }
      ]
    },
    from: {
      rules: [
        {
          required: true,
          errorMessage: "请选择渠道"
        }
      ]
    },
    student_situation: {
      rules: [
        {
          required: true,
          errorMessage: "请输入学生情况"
        }
      ]
    }
  },
  formList: [
    {
      formType: "input",
      name: "username",
      label: "学生姓名",
      placeholder: "请输入学生姓名",
      value: "",
      required: true
    },
    {
      formType: "input",
      name: "phone",
      label: "手机号码",
      type: "tel",
      placeholder: "请输入手机号码",
      value: "",
      required: true
    },
    {
      formType: "input",
      name: "mailbox",
      label: "邮箱",
      placeholder: "请输入邮箱",
      value: ""
    },
    {
      formType: "select",
      name: "school_id",
      label: "学校名称",
      placeholder: "总校",
      value: "",
      options: uni.getStorageSync("dictMap")
        ? uni.getStorageSync("dictMap").allSchool.map((m) => {
            return {
              text: m.school_name,
              value: m.id
            }
          })
        : [],
      required: true
    },
    {
      formType: "radio",
      name: "sex",
      label: "性别",
      placeholder: "请选择性别",
      value: "",
      options: [
        {
          text: "男",
          value: 1
        },
        {
          text: "女",
          value: 2
        },
        {
          text: "未知",
          value: 3
        }
      ]
    },
    {
      formType: "input",
      name: "age",
      type: "number",
      label: "年龄",
      placeholder: "请输入年龄",
      value: ""
    },
    {
      formType: "input",
      name: "grade",
      label: "年级",
      placeholder: "请输入年级",
      value: ""
    },
    {
      formType: "input",
      name: "parents_phone",
      label: "家长手机号",
      placeholder: "请输入家长手机号",
      value: ""
    },
    {
      formType: "select",
      name: "from",
      label: "渠道",
      placeholder: "请选择",
      value: "",
      options: [
        {
          text: "个人",
          value: 1
        },
        {
          text: "电销",
          value: 2
        },
        {
          text: "抖音",
          value: 3
        },
        {
          text: "地摊",
          value: 4
        },
        {
          text: "合作",
          value: 5
        },
        {
          text: "介绍",
          value: 6
        }
      ],
      required: true
    },
    {
      formType: "input",
      type: "textarea",
      name: "student_situation",
      label: "学生情况",
      placeholder: "",
      value: "",
      autosize: {
        maxHeight: 100,
        minHeight: 50
      },
      required: true
    }
    // {
    // 	formType: 'date',
    // 	name: 'date',
    // 	label: '选择日期',
    // 	placeholder: '请选择日期',
    // 	value: '',
    // },
    // {
    // 	formType: 'upload',
    // 	name: 'file',
    // 	label: '身份证正面照',
    // 	value: '',
    // 	required: true
    // },
  ],
  formField: {
    username: "",
    phone: "",
    mailbox: "",
    school_id: "",
    sex: "",
    parents_phone: "",
    grade: "",
    age: "",
    from: "",
    student_situation: ""
  }
}
export { addStuForm }
